package com.echo.study.spring.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.echo.study.spring.dao.BaseRepository;

public class BaseService<T> {
	@Autowired
	private BaseRepository<T> repository;
	
	@Transactional(propagation=Propagation.SUPPORTS,isolation=Isolation.READ_COMMITTED)
	public int   add() throws Exception {
     //执行了 前置通知
	System.out.println("com.echo.study.spring.service.add 开始执行");
		repository.save();
	System.out.println("com.echo.study.spring.service.add 执行结束");
	//准备执行后置通知
	return 100;
	}

}
